


package com.zixi.selenium;

import java.util.regex.Pattern;
import java.util.concurrent.TimeUnit;

import org.testng.*;
import org.testng.annotations.*;

import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;

import org.openqa.selenium.*;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class AfterLog extends com.zixi.selenium.pages.TestBase {
  private boolean acceptNextAlert = true;
  private StringBuffer verificationErrors = new StringBuffer();

  @Test
  public void zafterLog() throws Exception 
  {
	Thread.sleep(3000);
    driver.get(baseUrl + "/users/sign_in");
    WebElement username = driver.findElement(By.id("user_email"));
	username.clear();
    username.sendKeys("");
    username.clear();
    username.sendKeys("admin@zixi.com");
    driver.findElement(By.id("user_password")).clear();
    driver.findElement(By.id("user_password")).sendKeys("mnk90DNK91");
    driver.findElement(By.id("user_session_submit")).click();
    
    Thread.sleep(10000);
    
    driver.findElement(By.id("ui-id-2")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ui-id-1")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ui-id-2")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ui-id-2")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ui-id-1")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ui-id-2")).click();
    Thread.sleep(1000);
    driver.findElement(By.id("ui-id-1")).click();
    Thread.sleep(1000);
 }

  private boolean isElementPresent(By by) {
    try {
      driver.findElement(by);
      return true;
    } catch (NoSuchElementException e) {
      return false;
    }
  }

  private String closeAlertAndGetItsText() {
    try {
      Alert alert = driver.switchTo().alert();
      String alertText = alert.getText();
      if (acceptNextAlert) {
        alert.accept();
      } else {
        alert.dismiss();
      }
      return alertText;
    } finally {
      acceptNextAlert = true;
    }
  }
}
